// DCTNSNP.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "GRASP.h"
#include "Dijkstra.h"
#include <string>

using namespace std;

/*
	Tests de correctitud de dijkstra personalizado
*/
void testDijkstra() {

	string rutaEsc("mandl\\red.txt");
	Red * red = new Red();
	red->leer(rutaEsc);
	int cantNodos = red->getCantidadNodos();

	Path p;
	Red * destino = new Red(red);
	InfoVerticeSet nodosARemover;
	nodosARemover.insert(InfoVertice(0, true));
	nodosARemover.insert(InfoVertice(1, true));
	nodosARemover.insert(InfoVertice(2, true));
	nodosARemover.insert(InfoVertice(3, true));
	nodosARemover.insert(InfoVertice(4, true));
	destino->removerNodos(nodosARemover);
	
	Dijkstra::ejecutar(destino, InfoVertice(0, true), p, red, cantNodos);
	// p = 0, 1, 2, 5, costo = 13
	Dijkstra::ejecutar(destino, InfoVertice(4, true), p, red, cantNodos);
	// p = 4,3,5, costo = 8
	Dijkstra::ejecutar(destino, InfoVertice(3, true), p, red, cantNodos);
	// p = 3,5, costo = 4

	destino = new Red(red);
	nodosARemover.insert(InfoVertice(5, true));
	destino->removerNodos(nodosARemover);
	Dijkstra::ejecutar(destino, InfoVertice(0, true), p, red, cantNodos);
	// p = 0, 1, 2, 5,7 costo = 15
	Dijkstra::ejecutar(destino, InfoVertice(1, true), p, red, cantNodos);
	// p = 1,2,5,7, costo = 7

	destino = new Red(red);
	nodosARemover.insert(InfoVertice(11, true));
	destino->removerNodos(nodosARemover);
	Dijkstra::ejecutar(destino, InfoVertice(11, true), p, red, cantNodos);
	// p = 11,10 costo = 10

	return;
}


int _tmain(int argc, _TCHAR* argv[])
{
	//testDijkstra();
	
	string rutaEsc("mandl\\red.txt");
	Red * red = new Red();
	red->leer(rutaEsc);

	int lSize = 4;
	int iter = 100;
	GRASP * algoritmo = new GRASP(red, lSize, iter);
	algoritmo->ejecutar();

	Red * sol = algoritmo->getSolucion();
	printf("Test\n");
	delete algoritmo;
	

	return 0;
}

